<template>
  <div class="Customerrfm_container">
    <Row>
      <Col span="24">
        <div class="nav">
          <h2 class="addcustomergroup_title">客户RFM报表</h2>
        </div>
      </Col>
    </Row>
    <!-- 查询 -->
    <Row>
      <Col span="24">
        <div class="Customerrfm">
          <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="90">
            <Row>
              <Col span="8">
                <FormItem label="选择渠道：" prop="channel_id">
                  <Select v-model="formValidate.channel_id" placeholder="请选择.." style="width:10vw;">
                   <Option value="0">全部</Option>
                    <Option
                      v-for="item in channels"
                      :value="item.id"
                      :key="item.value"
                    >{{ item.name }}</Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="8">
                <FormItem label="选择人群：" prop="memberType">
                  <Select v-model="formValidate.memberType" placeholder="请选择" style="width:10vw;">
                    <Option value="0">全部</Option>
                    <Option value="1">会员</Option>
                    <Option value="2">粉丝</Option>
                    <Option value="3">顾客</Option>
                  </Select>
                </FormItem>
              </Col>

              <FormItem style="margin-top:8vh;margin-left:-5vw;">
                <Row>
                  <Col span="8">
                    <Button type="success" style="width:10vw;" @click="handleSubmitrmf()">查询</Button>
                  </Col>
                  <Col span="3" push="10">
                    <Button
                      type="success"
                      style="width:10vw;margin-left:1vw;"
                      @click="exportData()"
                    >下载</Button>
                  </Col>
                </Row>
              </FormItem>
            </Row>
          </Form>
        </div>
      </Col>
    </Row>
    <!-- 查询结果 -->
    <Row>
      <Col span="24">
        <div class="table_box">
          <Row>
            <Col span="6" class="modaltext">
              <span @click="showR(name)" >R设置</span>
              <span @click="showF(name)" >F设置</span>
              <span @click="showM(name)" >M设置</span>
            </Col>
          </Row>
          <Row>
            <Col span="24">
              <!-- 表格 -->
              <div class="table_container" v-if="showTable">
                <Table class="table_search_result"  height="300"  border size="small" ref="rfmtable" :columns="columns" :data="formList" ></Table>
              </div>
            </Col>
          </Row>

          
        </div>
        <Modal v-model="modal" title="RFM设置">
          <Tabs :value="name">
            <TabPane label="R设置" name="R">
              <Form
                ref="rformValidate"
                :model="rformValidate"
                :rules="ruleValidate"
                :label-width="60"
              >
                <Row>
                  <Col span="8">
                    <FormItem label="起始于">
                      <Input placeholder="请输入数字" v-model="rformValidate.rbeginnumber" @on-change="Subtraction" clearable style="width:100px"/>
                    </FormItem>
                  </Col>
                  <Col span="8" >
                    <FormItem label="终止于" prop="endnumber" >
                      <Input  placeholder="请输入数字" v-model="rformValidate.rendnumber" @on-change="Subtraction" clearable style="width:100px"/>
                    </FormItem>
                    </Col>
                  <Col span="8">
                    <FormItem label="区间数" prop="rblock">
                      <Input placeholder="请输入数字" v-model="rformValidate.rblock" @on-change="Subtraction" style="width:100px" clearable/>
                    </FormItem>
                  </Col>
                </Row>
                <Row style="background-color:#f7f7f7;margin:2vh 0px 0px 0px;">
                  <Col span="24">
                    <FormItem
                      v-for="(item, index) in rformValidate.items"
                      v-if="item.status"
                      :key="index"
                      :prop="'items.' + index + '.value'"
                      style="padding:2vh 0px 0px 0px;"
                    >
                      <Row>
                        <Col span="18">
                          <Input
                            type="text"
                            v-model="item.rrangebegin"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                          <span>≤&nbsp;R&nbsp;＜</span>
                          <Input
                            type="text"
                            v-model="item.rrangeend"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                        </Col>
                        <Col span="4" offset="1">
                          <Button v-if="item.status==1" @click="handleAdd">+添加</Button>
                          <!-- <Button v-if="item.status==2" @click="handleAdd">+添加</Button> -->
                          <Button v-if="item.status==2" @click="handleRemove(index)">+删除</Button>                        
                        </Col>
                      </Row>
                    </FormItem>
                  </Col>
                </Row>
              </Form>
            </TabPane>
            <TabPane label="F设置" name="F">
              <Form
                ref="fformValidate"
                :model="fformValidate"
                :rules="ruleValidate"
                :label-width="60"
              >
                <Row>
                  <Col span="8">
                  <FormItem label="起始于">
                      <Input placeholder="请输入数字" v-model="fformValidate.fbeginnumber" @on-change="fSubtraction" clearable style="width:100px"/>
                    </FormItem>
                  </Col>
                  <Col span="8" >
                    <FormItem label="终止于" prop="endnumber" >
                      <Input placeholder="请输入数字" v-model="fformValidate.fendnumber" @on-change="fSubtraction" clearable style="width:100px"/>
                    </FormItem>
                    </Col>
                  <Col span="8">
                    <FormItem label="区间数" prop="fblock">
                      <Input  placeholder="请输入数字" v-model="fformValidate.fblock" @on-change="fSubtraction" clearable style="width:100px"/>
                    </FormItem>
                  </Col>
                </Row>
                <Row style="background-color:#f7f7f7;margin:2vh 0px 0px 0px;">
                  <Col span="24">
                    <FormItem
                      v-for="(item, index) in fformValidate.items"
                      v-if="item.status"
                      :key="index"
                      :prop="'items.' + index + '.value'"
                      style="padding:2vh 0px 0px 0px;"
                    >
                      <Row>
                        <Col span="18">
                          <Input
                            type="text"
                            v-model="item.frangebegin"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                          <span>≤&nbsp;F&nbsp;＜</span>
                          <Input
                            type="text"
                            v-model="item.frangeend"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                        </Col>
                        <Col span="4" offset="1">
                          <Button v-if="item.status==1" @click="fhandleAdd">+添加</Button>
                          <!-- <Button v-if="item.status==2" @click="fhandleAdd">+添加</Button> -->
                          <Button v-if="item.status==2" @click="fhandleRemove(index)">+删除</Button>                        
                        </Col>
                      </Row>
                    </FormItem>
                  </Col>
                </Row>
              </Form>
            </TabPane>
            <TabPane label="M设置" name="M">
              <Form
                ref="mformValidate"
                :model="mformValidate"
                :rules="ruleValidate"
                :label-width="60"
              >
                <Row>
                  <Col span="8">
                    <FormItem label="起始于">
                      <InputNumber placeholder="请输入数字" v-model="mformValidate.mbeginnumber" @on-change="mSubtraction" clearable style="width:100px"/></InputNumber>
                    </FormItem>
                  </Col>
                  <Col span="8" >
                    <FormItem label="终止于" prop="endnumber" >
                      <InputNumber placeholder="请输入数字" v-model="mformValidate.mendnumber" @on-change="mSubtraction" clearable style="width:100px"/></InputNumber>
                    </FormItem>
                    </Col>
                  <Col span="8">
                    <FormItem label="区间数" prop="mblock">
                      <Input  placeholder="请输入数字" v-model="mformValidate.mblock" @on-change="mSubtraction" clearable style="width:100px"/>
                    </FormItem>
                  </Col>
                </Row>
                <Row style="background-color:#f7f7f7;margin:2vh 0px 0px 0px;">
                  <Col span="24">
                    <FormItem
                      v-for="(item, index) in mformValidate.items"
                      v-if="item.status"
                      :key="index"
                      :prop="'items.' + index + '.value'"
                      style="padding:2vh 0px 0px 0px;"
                    >
                      <Row>
                        <Col span="18">
                          <Input
                            type="text"
                            v-model="item.mrangebegin"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                          <span>≤&nbsp;M&nbsp;＜</span>
                          <Input
                            type="text"
                            v-model="item.mrangeend"
                            placeholder="请输入数字"
                            clearable
                            style="width:120px;"
                          ></Input>
                        </Col>
                        <Col span="4" offset="1">
                          <Button v-if="item.status==1" @click="mhandleAdd">+添加</Button>
                          <Button @click="mhandleRemove(index)" v-else>删除</Button>
                        </Col>
                      </Row>
                    </FormItem>
                  </Col>
                </Row>
              </Form>
            </TabPane>
          </Tabs>
        </Modal>
      </Col>
    </Row>
  </div>
</template>
<script>
import {
  getMemberRFMReport,
  exportMemberRFMReport,
  fetchChannelList
} from "@/api/report";
export default {
  name: "Customerrfm",
  data() {
    return {
      rindex : 0,
      findex : 0,
      mindex : 0, 
      name:"R",
      showTable: false,
      index: 1,
      modal: false,
      reportList: [],
      nameList: [],
      formList: [],
      channels: [],
      resdata:"",
      r_interval:"",
      f_interval:"",
      m_interval:"",
      total: 0,
      start_time: "",
      end_time: "",
      channel_id: "0",
      memberType: "0",
      r: "",
      f: "",
      m: "",
      formValidate: {
        // 查询参数
        start_time: "",
        end_time: "",
        channel_id: "0",
        group: "",
        memberType: "0"
      },

      rformValidate: {
        // r模态框各个参数
        rbeginnumber: 0,
        rendnumber: 120,
        rblock: 4,
        items:[
          // R设置动态添加数组
          {
            value: "",
            index: "0",
            status: 1,
            rrangebegin: "0",
            rrangeend: "30"
          },
          {
            value: "",
            index: "1",
            status: 2,
            rrangebegin: "30",
            rrangeend: "60"
          },
          {
            value: "",
            index: "2",
            status: 2,
            rrangebegin: "60",
            rrangeend: "120"
          },
          {
            value: "",
            index: "3",
            status: 2,
            rrangebegin: "120",
            rrangeend: ""
          },
        ]
      },
      fformValidate: {
        // 模态框各个参数
        fbeginnumber: 1,
        fendnumber: 5,
        fblock: 4,
        index: "",
        items: [
          // f设置动态添加数组
          {
            value: "",
            index: "0",
            status: 1,
            frangebegin: "1",
            frangeend: "2"
          },{
            value: "",
            index: "1",
            status: 2,
            frangebegin: "2",
            frangeend: "3"
          },{
            value: "",
            index: "2",
            status: 2,
            frangebegin: "3",
            frangeend: "5"
          },{
            value: "",
            index: "3",
            status: 2,
            frangebegin: "5",
            frangeend: ""
          }
        ]
      },
      mformValidate: {
        // 模态框各个参数
        mbeginnumber: 0,
        mendnumber: 200,
        mblock: 3,
        index: 1,
        items: [
          // m设置动态添加数组
          {
            value: "",
            index: 0,
            status: 1,
            mrangebegin: "0",
            mrangeend: "100"
          },{
            value: "",
            index: 1,
            status: 2,
            mrangebegin: "100",
            mrangeend: "200"
          },{
            value: "",
            index: 2,
            status: 2,
            mrangebegin: "200",
            mrangeend: ""
          }
        ]
      }, 
      // 表格动态列
      columns: [],
      ruleValidate: {
    
      }
    };
  },
 
  created() {
    this.channelList();
    this.handleSubmitrmf();
  },
  methods: {
    showR(){

      this.modal = true;
      this.name = "R";
    },
    showF(){
      this.modal = true;
      this.name = "F";
    },
    showM(){
      this.modal = true;
      this.name = "M";
    },
    channelList() {
      fetchChannelList().then(res => {
        if (res.data.code == 200) {
          if (res.data.data) {
            this.channels = res.data.data;
          }
        } else {
          this.$Message.error("操作失败");
        }
      });
    },

    handleSubmitrmf() {
      this.showTable = false;
      // 提交from表单
      this.TableLoading = true;
      if(this.formValidate.channel_id==""){
        this.$Message.error("请选择渠道");
        return;
      }
      this.rindex = 0;
      this.findex = 0;
      this.mindex = 0;
      
      this.load = true;
      var r_arr = "";
      var f_arr = "";
      var m_arr = "";
      var column = "";
           

      var arr = this.rformValidate.items;
            this.rformValidate.items.map(item => {
              if((this.rformValidate.items.length-1) != Number(this.rindex)){
                if(Number(item.rrangebegin)>Number(item.rrangeend)){
                   this.$Message.error("R起始值不得大于结束值！");
                   br;
                }
              }else{
                if(item.rrangeend != ''){
                  if(Number(item.rrangebegin)>Number(item.rrangeend)){
                    this.$Message.error("R起始值不得大于结束值！");
                    br;
                  }
                }
              }
              this.rindex = Number(this.rindex)+1;
              r_arr = r_arr+item.rrangebegin + "-" + item.rrangeend +",";
            });

            r_arr=r_arr.slice(0,r_arr.length-1);
            
            this.fformValidate.items.map(item => {
              if((this.fformValidate.items.length-1) != Number(this.findex)){
                if(Number(item.frangebegin)>Number(item.frangeend)){
                    this.$Message.error("F起始值不得大于结束值！");
                    br;
                }
              }else{
                if(item.frangeend != ''){
                  if(Number(item.frangebegin)>Number(item.frangeend)){
                    this.$Message.error("F起始值不得大于结束值！");
                    br;
                  }
                }
              }
              this.findex = Number(this.findex)+1;
              f_arr = f_arr+item.frangebegin + "-" + item.frangeend +",";
            });
            f_arr=f_arr.slice(0,f_arr.length-1);

            this.mformValidate.items.map(item => {
              if((this.mformValidate.items.length-1) != Number(this.mindex)){
                if(Number(item.mrangebegin)>Number(item.mrangeend)){
                    this.$Message.error("M起始值不得大于结束值！");
                    br;
                }
              }else{
                if(item.mrangeend != ''){
                  if(Number(item.mrangebegin)>Number(item.mrangeend)){
                    this.$Message.error("M起始值不得大于结束值！");
                    br;
                  }
                }
              }
              this.mindex = Number(this.mindex)+1;
              m_arr = m_arr+item.mrangebegin + "-" + item.mrangeend +",";
            });
            m_arr=m_arr.slice(0,m_arr.length-1);
            var reqParams = {
              r: r_arr,
              f: f_arr,
              m: m_arr,
              channel_id: this.formValidate.channel_id,
              memberType: this.formValidate.memberType
            };
            if(this.formValidate.channel_id == 0){
              reqParams.channel_id = '';
            }
            if(this.formValidate.memberType == 0){
              reqParams.memberType = '';
            }
            getMemberRFMReport(reqParams).then(res => {
            this.TableLoading = false;
            if (res.data.code == 200) {
              this.reportList = res.data.result.reportLists;
              this.formList = res.data.result.formList;
              this.nameList = res.data.result.nameList;
              if(this.columns.length > 0){
                this.columns.splice(0,this.columns.length);
              }
              
              for (let index = 0; index < this.nameList.length; index++) {
                    column = {title:this.nameList[index],key: this.nameList[index], align: 'center'} ;
                    this.columns.push(column);  
              }
              this.showTable = true;
            }
          })
          .catch(error => {
            this.$Message.error(error);
          });
    },
   
     exportData() {
      this.$refs.rfmtable.exportCsv({
          filename: "客户rfm报表"
        });
    },

    handleAdd() {
      var length = this.rformValidate.items.length;
      if(length==0){
        // R设置添加事件
        this.index=this.rformValidate.items.length-1;
        this.index++;
        this.rformValidate.items.push({
          value: "",
          index: this.index,
          status: 1,
          rrangebegin: "",
          rrangeend: ""
        });
      }else{
        // R设置添加事件
        this.index=this.rformValidate.items.length-1;
        this.index++;
        this.rformValidate.items.push({
          value: "",
          index: this.index,
          status: 2,
          rrangebegin: "",
          rrangeend: ""
        });
      }
      
    },
    handleRemove(index) {
      // R设置删除事件
      // this.rformValidate.items[index].status = 0;
      this.rformValidate.items.splice(index, 1);
    },
    fhandleAdd() {
      var length = this.fformValidate.items.length;
      if(length==0){
        // F设置添加事件
        this.index=this.fformValidate.items.length;
        this.index++;
        this.fformValidate.items.push({
          value: "",
          index: this.index,
          status: 1,
          frangebegin: "",
          frangeend: ""
        });
      }else{
        // F设置添加事件
        this.index=this.fformValidate.items.length;
        this.index++;
        this.fformValidate.items.push({
          value: "",
          index: this.index,
          status: 2,
          frangebegin: "",
          frangeend: ""
        });
      }   
    },
    fhandleRemove(index) {
      // F设置删除事件
      this.fformValidate.items.splice(index, 1);
    },
    mhandleAdd() {
      var length = this.mformValidate.items.length;
      if(length==0){
        // M设置添加事件
        this.index++;
        this.mformValidate.items.push({
          value: "",
          index: this.index,
          status: 1,
          mrangebegin: "",
          mrangeend: ""
        });
      }else{
        // M设置添加事件
        this.index++;
        this.mformValidate.items.push({
          value: "",
          index: this.index,
          status: 2,
          mrangebegin: "",
          mrangeend: ""
        });
      }
      
    },
    mhandleRemove(index) {
      // M设置删除事件
      // this.mformValidate.items[index].status = 0;
      this.mformValidate.items.splice(index, 1);
    },
    Subtraction() {
      if(this.rformValidate.rbeginnumber>this.rformValidate.rendnumber){
        return;
      }
      if(this.rformValidate.rblock!=0){
        this.r_interval = Math.abs((Number(this.rformValidate.rbeginnumber) - Number(this.rformValidate.rendnumber))/this.rformValidate.rblock);
      }
      this.r_interval=Number(this.r_interval).toFixed(1);   
      var length = this.rformValidate.items.length;
      var num = "";
      if(this.rformValidate.rblock>=length){
         num = Math.abs(Number(this.rformValidate.rblock) - Number(length));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.handleAdd(); 
            }
            for (let index = 0; index < this.rformValidate.rblock; index++) {
               this.rformValidate.items[index].rrangebegin = Math.abs(Number(this.r_interval*index)+Number(this.rformValidate.rbeginnumber)).toFixed(1);
               this.rformValidate.items[index].rrangeend = Math.abs(Number(this.r_interval*(index+1))+Number(this.rformValidate.rbeginnumber)).toFixed(1);       
            }
            this.rformValidate.items[this.rformValidate.items.length-1].rrangeend = this.rformValidate.rendnumber;
         }else{
            for (let index = 0; index < this.rformValidate.rblock; index++) {
               this.rformValidate.items[index].rrangebegin = Math.abs(Number(this.r_interval*index)+Number(this.rformValidate.rbeginnumber)).toFixed(1);
               this.rformValidate.items[index].rrangeend = Math.abs(Number(this.r_interval*(index+1))+Number(this.rformValidate.rbeginnumber)).toFixed(1);    
            }
            this.rformValidate.items[this.rformValidate.items.length-1].rrangeend = this.rformValidate.rendnumber;
         }
      }else{
         num = Math.abs(Number(length) - Number(this.rformValidate.rblock));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.handleRemove(0); 
            }
            for (let index = 0; index < this.rformValidate.rblock; index++) {
               this.rformValidate.items[index].rrangebegin = Math.abs(Number(this.r_interval*index)+Number(this.rformValidate.rbeginnumber)).toFixed(1);
               this.rformValidate.items[index].rrangeend = Math.abs(Number(this.r_interval*(index+1))+Number(this.rformValidate.rbeginnumber)).toFixed(1);     
            }
            this.rformValidate.items[this.rformValidate.items.length-1].rrangeend = this.rformValidate.rendnumber;

         }else{
            for (let index = 0; index < this.rformValidate.rblock; index++) {
               this.rformValidate.items[index].rrangebegin = Math.abs(Number(this.r_interval*index)+Number(this.rformValidate.rbeginnumber)).toFixed(1);
               this.rformValidate.items[index].rrangeend = Math.abs(Number(this.r_interval*(index+1))+Number(this.rformValidate.rbeginnumber)).toFixed(1);      
            }
            this.rformValidate.items[this.rformValidate.items.length-1].rrangeend = this.rformValidate.rendnumber;

         }
      }
      
    },
    fSubtraction() {
     if(this.fformValidate.fbeginnumber>this.fformValidate.fendnumber){
        return;
      }
      this.f_interval = Math.abs((Number(this.fformValidate.fbeginnumber) - Number(this.fformValidate.fendnumber))/this.fformValidate.fblock);
      this.f_interval=Number(this.f_interval).toFixed(1);   
      var length = this.fformValidate.items.length;
      var num = "";
      if(this.fformValidate.fblock>=length){
         num = Math.abs(Number(this.fformValidate.fblock) - Number(length));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.fhandleAdd(); 
            }
            for (let index = 0; index < this.fformValidate.fblock; index++) {
              this.fformValidate.items[index].frangebegin = Math.abs(Number(this.f_interval*index)+Number(this.fformValidate.fbeginnumber)).toFixed(1);
              this.fformValidate.items[index].frangeend = Math.abs(Number(this.f_interval*(index+1))+Number(this.fformValidate.fbeginnumber)).toFixed(1);       
            }
            this.fformValidate.items[this.fformValidate.items.length-1].frangeend = this.fformValidate.fendnumber;
         }else{
            for (let index = 0; index < this.fformValidate.fblock; index++) {
               this.fformValidate.items[index].frangebegin = Math.abs(Number(this.f_interval*index)+Number(this.fformValidate.fbeginnumber)).toFixed(1);
               this.fformValidate.items[index].frangeend = Math.abs(Number(this.f_interval*(index+1))+Number(this.fformValidate.fbeginnumber)).toFixed(1);    
            }
            this.fformValidate.items[this.fformValidate.items.length-1].frangeend = this.fformValidate.fendnumber;

         }
      }else{
         num = Math.abs(Number(length) - Number(this.fformValidate.fblock));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.fhandleRemove(0); 
            }
            for (let index = 0; index < this.fformValidate.fblock; index++) {
               this.fformValidate.items[index].frangebegin = Math.abs(Number(this.f_interval*index)+Number(this.fformValidate.fbeginnumber)).toFixed(1);
               this.fformValidate.items[index].frangeend = Math.abs(Number(this.f_interval*(index+1))+Number(this.fformValidate.fbeginnumber)).toFixed(1);     
            }
            this.fformValidate.items[this.fformValidate.items.length-1].frangeend = this.fformValidate.fendnumber;
         }else{
            for (let index = 0; index < this.fformValidate.fblock; index++) {
               this.fformValidate.items[index].frangebegin = Math.abs(Number(this.f_interval*index)+Number(this.fformValidate.fbeginnumber)).toFixed(1);
               this.fformValidate.items[index].frangeend = Math.abs(Number(this.f_interval*(index+1))+Number(this.fformValidate.fbeginnumber)).toFixed(1);      
            }
            this.fformValidate.items[this.fformValidate.items.length-1].frangeend = this.fformValidate.fendnumber;
         }
      }
    },
    mSubtraction() {
      if(this.mformValidate.mbeginnumber>this.mformValidate.mendnumber){
        return;
      }
      this.m_interval = Math.abs((Number(this.mformValidate.mbeginnumber) - Number(this.mformValidate.mendnumber))/this.mformValidate.mblock);
      this.m_interval=Number(this.m_interval).toFixed(1);   
      var length = this.mformValidate.items.length;
      var num = "";
      if(this.mformValidate.mblock>=length){
         num = Math.abs(Number(this.mformValidate.mblock) - Number(length));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.mhandleAdd(); 
            }
            for (let index = 0; index < this.mformValidate.mblock; index++) {
               this.mformValidate.items[index].mrangebegin = Math.abs(Number(this.m_interval*index)+Number(this.mformValidate.mbeginnumber)).toFixed(1);
               this.mformValidate.items[index].mrangeend = Math.abs(Number(this.m_interval*(index+1))+Number(this.mformValidate.mbeginnumber)).toFixed(1);       
            }
            this.mformValidate.items[this.mformValidate.items.length-1].mrangeend = this.mformValidate.mendnumber;
         }else{
            for (let index = 0; index < this.mformValidate.mblock; index++) {
               this.mformValidate.items[index].mrangebegin = Math.abs(Number(this.m_interval*index)+Number(this.mformValidate.mbeginnumber)).toFixed(1);
               this.mformValidate.items[index].mrangeend = Math.abs(Number(this.m_interval*(index+1))+Number(this.mformValidate.mbeginnumber)).toFixed(1);    
            }
            this.mformValidate.items[this.mformValidate.items.length-1].mrangeend = this.mformValidate.mendnumber;
         }
      }else{
         num = Math.abs(Number(length) - Number(this.mformValidate.mblock));
         if(num>0){
            for (let index = 0; index < num; index++) {
                 this.mhandleRemove(0); 
            }
            for (let index = 0; index < this.mformValidate.mblock; index++) {
               this.mformValidate.items[index].mrangebegin = Math.abs(Number(this.m_interval*index)+Number(this.mformValidate.mbeginnumber)).toFixed(1);
               this.mformValidate.items[index].mrangeend = Math.abs(Number(this.m_interval*(index+1))+Number(this.mformValidate.mbeginnumber)).toFixed(1);     
            }
            this.mformValidate.items[this.mformValidate.items.length-1].mrangeend = this.mformValidate.mendnumber;
         }else{
            for (let index = 0; index < this.mformValidate.mblock; index++) {
               this.mformValidate.items[index].mrangebegin = Math.abs(Number(this.m_interval*index)+Number(this.mformValidate.mbeginnumber)).toFixed(1);
               this.mformValidate.items[index].mrangeend = Math.abs(Number(this.m_interval*(index+1))+Number(this.mformValidate.mbeginnumber)).toFixed(1);      
            }
            this.mformValidate.items[this.mformValidate.items.length-1].mrangeend = this.mformValidate.mendnumber;
         }
      }
    }
  },

  mounted() {}
};
</script>
<style lang="scss" scoped>
@import "../../styles/common.scss";
.Customerrfm_container {
  @include container_global;
  overflow: hidden;
  background-color: #fff;
  .nav {
    height: 7vh;
    padding-left: 1vw;
    line-height: 35px;
    background-color: #fff;
    .addcustomergroup_title {
      height: 7vh;
      font-weight: bolder;
    }
  }
  .table_box {
    width: 84vw;
    min-height: 60vh;
    margin: 2vh 0px 0px 1vw;
    background-color: #fff;
    .modaltext {
      height: 40px;
      line-height: 40px;
      font-size: 14px;
      display: flex;
      color: #0e92eb;
      background-color: #fbfcfc;
      justify-content: space-around;
      span:hover {
        cursor: pointer;
      }
    }
  }
  .table_container {
    border: 1px solid #e8edf1;
    .table_search_result {
      width: 84vw;
      height: 300px;
      border: 1px solid #e8edf1;
    }
  }
  .page {
    width: 80vw;
    height: 60px;
    margin-top: 2vh;
    display: flex;
    justify-content: center;
  }
}
</style>
